package com.github.lee.core.common


import java.math.BigDecimal
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.*

fun doubleFormat(number: Double, pattern: String): String {
    val decimal = BigDecimal(number)
    val format = DecimalFormat(pattern)
    return format.format(decimal)
}

fun intFormat(number: Int, pattern: String): String {
    val decimal = BigDecimal(number)
    val format = DecimalFormat(pattern)
    return format.format(decimal)
}

fun dateFormat(date: Long, pattern: String): String {
    return SimpleDateFormat(pattern, Locale.CHINA).format(date)
}